/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package alcatelparser.tags;

import alcatelparser.modules.AlgoUtil;
import alcatelparser.modules.BuilderFactory;
import alcatelparser.modules.I;

/**
 *
 * @author geniuz
 */
public class ReasonForOutputTag extends DefaultParserTag
{

    public ReasonForOutputTag()
    {
    }

    public final void parseTag(int ai[], int i)
    {
        setStandartLength(ai, i);
        
        _array = ai;
        _startParsePosition = i;
        if(isTagChecked(I.I(5395)))
        {
            int j = AlgoUtil.getLength(_array, i + 1);
            String s = getTagPropertiesValue((new StringBuilder()).append(I.I(7281)).append(ai[i + 2]).toString());
            if(isFullForm())
            {
                String s1 = getTagPropertiesValue(I.I(7293));
                String s3 = (new StringBuilder()).append(getTagIdentifyContent(i, i + 1)).append(getHexStringContent(i + 2, j)).append(I.I(5425)).append(s).toString();
                BuilderFactory.getBuilder().writeTagContent(2, 0, s1, s3);
            } else
            {
                String s2 = getReducedTagPropertiesValue(I.I(7293));
                if(isFieldsDecoding())
                    BuilderFactory.getBuilder().writeTagContent(2, 0, s2, s);
                else
                    BuilderFactory.getBuilder().writeTagContent(2, 0, s2, (new StringBuilder()).append(I.I(548)).append(ai[i + 2]).toString());
            }
        }
        checkNonDefinedTagLength(i);
        _readBytesCount += 2;
    }

    public final String getParseIdentityTag()
    {
        return I.I(7278);
    }

    public final boolean isTagRequired()
    {
        return true;
    }
}
